/*--------------------------------------------------------------
 * File: demo32.c 编码类型：C语言  UTF-8
 * Author WRS (1352509846@qq.com)
 * 功能: 判断Armstrong数(阿姆斯壮数)
 * Armstrong 数，就是n位数的各位数的n次方之和等于该数，如：
 * 
    153=1^3+5^3+3^3
    1634=1^4+6^4+3^4+4^4
 * Version 0.1
 * Date 2022-01-29 
 * 
 * @copyright Copyright (c) 2022
 * 
----------------------------------------------------------------*/
#include <stdio.h>

int main(int argc, char const *argv[])
{
    int num;
    int originalNUM, remainder, result = 0;
    
    printf("请输入一个三位数：");
    scanf("%d",&num);
    originalNUM = num;

    while (originalNUM != 0)
    {
        remainder = originalNUM % 10;
        result += remainder*remainder*remainder;
        originalNUM /= 10;
    }
    
    if(result == num)
        printf("%d是Armstrong 数\n",num);
    else
        printf("%d不是Armstrong 数\n",num);

    return 0;
}

